//
// Created by liushuai on 2021/2/20.
//

#include "findDisappearedNumbers.h"
<<<<<<< HEAD:cxx/algorithm/src/findDisappearedNumbers.cc
//数组值指向的位置置为负数，整数位置的索引为结果（注意索引）
vector<int> findDisappearedNumbers(vector<int>& nums){
    vector<int>res;
    int count = 0;
    int record = 0;
    for(int i=0;i<nums.size();i++){
        if(nums[i]<0)
            nums[-nums[i]-1] = nums[-nums[i]-1]>0?-nums[-nums[i]-1]:nums[-nums[i]-1];
        else
            nums[nums[i]-1] = nums[nums[i]-1]>0?-nums[nums[i]-1]:nums[nums[i]-1];

    }
    for(int i=0;i<nums.size();i++){
        if(nums[i]>0)
            res.push_back(i+1);
    }
    return res;
=======
// 数组值指向的位置置为负数，整数位置的索引为结果（注意索引）
vector<int> findDisappearedNumbers(vector<int>& nums) {
  vector<int> res;
  int count = 0;
  int record = 0;
  for (int i = 0; i < nums.size(); i++) {
    if (nums[i] < 0)
      nums[-nums[i] - 1] =
          nums[-nums[i] - 1] > 0 ? -nums[-nums[i] - 1] : nums[-nums[i] - 1];
    else
      nums[nums[i] - 1] =
          nums[nums[i] - 1] > 0 ? -nums[nums[i] - 1] : nums[nums[i] - 1];
  }
  for (int i = 0; i < nums.size(); i++) {
    if (nums[i] > 0) res.push_back(i + 1);
  }
  return res;
>>>>>>> dev:cxx/algorithm/common/src/findDisappearedNumbers.cc
}